<%@page contentType="text/html;charset=utf-8" %>
<%@taglib prefix="s" uri="/struts-tags" %>   
<script type="text/javascript">

function cm_savechannelapp(type)
{
    var id = document.getElementById("model.id").value;
    var appname = document.getElementById("model.appname").value;
    var apppackage = document.getElementById("model.apppackage").value;

    var channelid = dijit.byId("channelid").get('value');
    var projectid = dijit.byId("projectid").get('value');

    if (appname == null || appname == ""
        || apppackage == null || apppackage == ""
        	|| channelid == null || channelid == ""
        		|| projectid == null || projectid == "")
    {
        alert("信息不完整！");
        return false;
    }

    if (!confirm("确定继续？"))
    {
        return false;
    }
    var url = "mg/channelapp/save.do?type=" + type;
    
    var objectid = "cm_channelappdiv";
    postXMLHttpRequest(url, "myform", objectid);
}
function manager_channelapp_change_channel()
{
    var url = "mg/channelapp/changechannel.do";
    var content = "channelid=" + dijit.byId("channelid").get('value');
    var objectid = "channelapp_projects";
    sendXMLHttpRequest(url, content, objectid); 
};
</script>
 <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="5"></td>
    <td>   
  <form id="myform" name="myform" id="myform" enctype="multipart/form-data" 
        method="post" action="">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td colspan="3">
        <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><img src="images/table_top_left.jpg" width="20" height="15" /></td>
            <td><img src="images/table_top_bg.jpg" width="770" height="15"/></td>
            <td align="right">
              <img src="images/table_top_right.jpg" width="20" height="15" /></td>
          </tr>
        </table>
      </td>
    </tr>
    <tr>
      <td height="25" colspan="3" class="table_blue">
        <strong><img src="images/dot.jpg" width="13" height="9">渠道包信息</strong></td>
    </tr> 
     <tr>
      <td class="table_w1" align="center" width="20%">&nbsp;<font color="red"></font>渠道包编号：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input id="model.channelappnumber" name="model.channelappnumber" type="text" size="60" readonly="readonly" 
          value="<s:property value="model.channelappnumber" />" /></td>
    </tr>
    <tr>
      <td class="table_w1" align="center" width="20%">&nbsp;<font color="red">(*)</font>名称：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input id="model.appnumber" name ="model.appnumber" type="hidden" value="<s:property value="model.appnumber" />" >
        <input id="model.cpid" name ="model.cpid" type="hidden" value="<s:property value="cp.id" />" >
        <input id="model.id" name="model.id" type="hidden" value="<s:property value="model.id" />" >
        <input id="model.appname" name="model.appname" type="text" size="60" 
          value="<s:property value="model.appname" />" /></td>
    </tr>
    <tr>
      <td class="table_w1" align="center" width="10%">&nbsp;<font color="red">(*)</font>包名：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input id="model.apppackage" name="model.apppackage" type="text" size="60" 
          value="<s:property value="model.apppackage" />" /> 
      </td>
    </tr>
    <tr>
      <td class="table_w1" align="center" width="10%">&nbsp;版本：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input id="model.appversion" name="model.appversion" type="text" size="60" 
          value="<s:property value="model.appversion" />" /> 
      </td>
    </tr>
    <tr>
      <td class="table_w1" align="center" width="10%">&nbsp;入口：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input id="model.appentry" name="model.appentry" type="text" size="60" 
          value="<s:property value="model.appentry" />" /> 
      </td>
    </tr>
    <tr>
      <td class="table_w1" align="center" width="10%">&nbsp;APP文件：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input type="file" id="appfile" name="appfile" size="60" /> 
      </td>
    </tr>
    <tr>
      <td class="table_w1" align="center" width="10%">&nbsp;APPICON：</td>
      <td class="table_w2" colspan="2">&nbsp;
        <input type="file" id="appicon" name="appicon" size="60" />
      </td>
    </tr>
     <tr>
      <td class="table_w1" align="center" width="20%">&nbsp;<font color="red">(*)</font>推广渠道：</td>
      <td class="table_w2" colspan="2">&nbsp;
      	<select id="channelid" name="channelid" dojoType="dijit.form.FilteringSelect" style="width:135px;" onchange="manager_channelapp_change_channel();">
               <option value="">请选择</option>
               <s:iterator value="channels" status="stat">
               <option value="<s:property value="id" />" <s:if test="id.equals(model.channelid)">selected</s:if>><s:property value="name" /></option>
               </s:iterator>
             </select></div>
      </td>
    </tr>
    <tr>
      <td class="table_w1" align="center" width="10%">&nbsp;<font color="red">(*)</font>项目：</td>
      <td class="table_w2" colspan="2">&nbsp;<div id="channelapp_projects"><s:include value="_changechannel.jsp"/></div>
      </td>
    </tr>
    <tr>
      <td colspan="3" class="table_w1" align="center">
        <s:if test="type.equals('insert')" >
        <button id="btn2" dojoType="dijit.form.Button"
            onclick="cm_savechannelapp('insert');">添加</button>
        </s:if>
        <s:else>
        &nbsp; &nbsp;
        <button id="btn4" dojoType="dijit.form.Button"
            onclick="cm_savechannelapp('update');">修改</button>
        </s:else>
      </td>      
    </tr>
    <tr> 
      <td colspan="3" background="images/table_bom_bg.jpg">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="images/table_bom_left.jpg" width="20" height="15"></td>
          <td></td>
          <td align="right">
            <img src="images/table_bom_right.jpg" width="20" height="15"></td>
        </tr>
        </table>
      </td>
    </tr>
  </table>  
  </form>
  </td>
  <td width="5"></td>
  </tr>
  </table>